#模块collections中的一个类——OrderedDict
#创建字典并记录其中的键——值对的添加顺序，
from collections import  OrderedDict

favorite_languages = OrderedDict()
#创建一个字典favorite_languages 并按顺序为key添加value
favorite_languages['jen'] = 'python'
favorite_languages['jack'] = 'C'
favorite_languages['phil'] = 'C++'
favorite_languages['sophia'] = 'Java'
'''遍历字典的键值对'''
for name,language in favorite_languages.items():  # items()函数以列表返回可遍历的键、值
    print(name.title()+"'s favorite language is " + language.title() +'.' )

